package encryption

import (
	"encoding/base64"
	"golang.org/x/crypto/scrypt"
	"log"
)

// 密码加密
func ScryptPw(password string) string {
	const KeyLen = 10
	salt := make([]byte, 8)
	salt = []byte{5, 25, 25, 52, 166, 18, 61, 01}
	HashPw,err := scrypt.Key([]byte(password), salt, 16384, 8, 1, KeyLen)
	if err != nil {
		log.Fatal(err)
	}
	fpw := base64.StdEncoding.EncodeToString(HashPw)
	return fpw
}
